package com.cytech.cloudclinic.adapter;

import android.view.View;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.cytech.cloudclinic.R;
import com.cytech.cloudclinic.bean.Drug;

import java.util.List;

public class BillAdapter extends BaseQuickAdapter<Drug, BaseViewHolder> {

    public BillAdapter(List<Drug> data) {
        super(R.layout.item_create_bill, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, Drug drug) {
        TextView tvGroup = baseViewHolder.getView(R.id.tv_prescription_group_tag);
        if(drug.headTitle ==-1){
            tvGroup.setVisibility(View.INVISIBLE);
        }else{
            tvGroup.setVisibility(View.VISIBLE);
            tvGroup.setText(String.valueOf(drug.headTitle));
        }
        baseViewHolder.setText(R.id.item_bill_name,drug.drug_name);
        baseViewHolder.setText(R.id.item_bill_size,drug.count +drug.cont_unit_text);
        baseViewHolder.setText(R.id.item_bill_price,drug.count *drug.sub_price+"元");
    }
}
